//引入axios
import axios from './axios'

//轮播图
export async function getBannerList() {
    let res = await axios.get("/bannerlist")
    return res.list
}

// 获取分类信息
export async function getCate() {
    let res = await axios.get("/getcate")
    console.log(1111,res);
    return res.list
}

// 获取商品信息(首页)
export async function getindexDoods() {
    let res = await axios.get("/getindexgoods")
    return res.list
}

//列表页
export async function getcateGoods(id, size, page) {
    let res = await axios.get(`/getcategoods?sid=${id}&page=${page}&size=${size}`)
    // console.log(res);
    return res
}
// 获取一条商品信息
export async function getgoodsinfo(id) {
    let res = await axios.get("/getgoodsinfo", { params: { id } })
    return res.list
}



// 购物车
export async function cartList(uid) {
    let res = await axios.get('/cartlist?uid=' + uid)
    return res
}
// 购物车添加
export async function cartAdd(data) {
    let res = await axios.post("/cartadd", data)
    console.log(res);
    return res.list
}
// 购物车修改
export async function cartEdit(data) {
    let res = await axios.post("/cartedit", data)
    return res.list
}
// 购物车删除
export async function cartDelete(id) {
    let res = await axios.post("/cartdelete",{id})
    return res.list
}


